<template>
  <div>
    <FormPanel ref="form" :cols="3" :list="formList" :labelWidth="100" :isSubmitBtn="false"></FormPanel>

    <div class="confirm-button-style">
      <el-button type="primary" @click="closeDialog">取 消</el-button>
    </div>
  </div>
</template>

<script>
import { dictionary } from '@/utils/dictMixin';

export default {
  name: 'repairCasedAdd',
  mixins: [dictionary],
  props: ['rowData'],
  data() {
    return {
      formList: this.createFormList()
    };
  },
  created() {
    this.formList.forEach(x => {
      x.initialValue = this.rowData[x.fieldName];
    });
    this.formList.forEach(x => {
      x.disabled = true;
    });

    console.log('传参', this.rowData);
  },
  methods: {
    createFormList() {
      return [
        {
          type: 'INPUT',
          label: '案例名称',
          fieldName: 'exampleTitle',
          selfCols: 3,
          rows: 2
        },
        {
          type: 'INPUT',
          label: '表单号',
          fieldName: 'exampleNo'
        },
        {
          type: 'INPUT',
          label: '表单状态',
          fieldName: 'status'
        },
        {
          type: 'INPUT',
          label: '故障部位',
          fieldName: 'faultPositionName'
        },
        {
          type: 'INPUT',
          label: '缺陷类型',
          fieldName: 'defectClassName'
        },
        {
          type: 'INPUT',
          label: '故障件',
          fieldName: 'faultPartName'
        },
        {
          type: 'INPUT',
          label: '故障系统',
          fieldName: 'faultSystemName'
        },
        {
          type: 'INPUT',
          label: '故障发生时间',
          fieldName: 'faultBeginTime'
        },
        {
          type: 'INPUT',
          label: '填表日期',
          fieldName: 'dCreate',
          readonly: true
        },
        {
          type: 'INPUT',
          label: '确认时间',
          fieldName: 'dConfirm'
        },
        {
          type: 'TEXT_AREA',
          label: '故障现象详细描述',
          fieldName: 'solutionCode',
          selfCols: 3,
          rows: 2
        },
        {
          type: 'INPUT',
          label: '问题解决渠道',
          fieldName: 'solutionName'
        },
        {
          type: 'INPUT',
          label: '维修项目',
          fieldName: 'itemName'
        },
        {
          type: 'INPUT',
          label: '更换备件',
          fieldName: 'replacePartName'
        },
        {
          type: 'TEXT_AREA',
          label: '最终解决方案',
          fieldName: 'finallySolution',
          selfCols: 3
        },
        {
          type: 'INPUT',
          label: '推送日期',
          fieldName: 'pushDate'
        },
        {
          type: 'INPUT',
          label: '推送人',
          fieldName: 'pushManName',
          offsetRightCols: 1
        },
        {
          type: 'INPUT',
          label: '案例经销商评分',
          fieldName: 'dealerScore'
        },
        {
          type: 'INPUT',
          label: '案例厂家评分',
          fieldName: 'factoryScore'
        },
        {
          type: 'INPUT',
          label: '案例汇总得分',
          fieldName: 'solutionScore'
        }
      ];
    },

    // 取消按钮关闭页面
    closeDialog(param) {
      console.log('点击关闭');
      this.$emit('close', false, param);
    }
  }
};
</script>

<style lang="less" scoped>
.confirm-button-style {
  position: absolute;
  left: 0;
  bottom: 0;
  right: 0;
  z-index: 9;
  border-top: 1px solid #e9e9e9;
  padding: 10px 20px;
  background: #fff;
  text-align: right;
}
</style>
